package net.spmiller;

public class Location {

    private final String latitude;
    private final String longitude;
    private final String gpsVersion;

    public Location(String latitude, String longitude, String gpsVersion) {
        this.latitude = latitude;
        this.longitude = longitude;
        this.gpsVersion = gpsVersion;
    }

    public Location(Location location) {
        this.latitude = location.latitude;
        this.longitude = location.longitude;
        this.gpsVersion = location.gpsVersion;

    }

    public String getLatitude() {
        return latitude;
    }

    public String getLongitude() {
        return longitude;
    }

    public String getGpsVersion() {
        return gpsVersion;
    }

    @Override
    public String toString() {
        return "Location{" +
                "latitude='" + latitude + '\'' +
                ", longitude='" + longitude + '\'' +
                ", gpsVersion='" + gpsVersion + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Location location = (Location) o;

        if (gpsVersion != null ? !gpsVersion.equals(location.gpsVersion) : location.gpsVersion != null) return false;
        if (latitude != null ? !latitude.equals(location.latitude) : location.latitude != null) return false;
        if (longitude != null ? !longitude.equals(location.longitude) : location.longitude != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = latitude != null ? latitude.hashCode() : 0;
        result = 31 * result + (longitude != null ? longitude.hashCode() : 0);
        result = 31 * result + (gpsVersion != null ? gpsVersion.hashCode() : 0);
        return result;
    }
}
